﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using ISSMoviePlex.BLL;
using ISSMoviePlex.DAL.Repositories;
using ISSMoviePlex.DAL.Models;


namespace ISSMoviePlex.Member.Controllers
{
    public class HomeController : Controller
    {
        AccountBLL accLogic = new AccountBLL();
        MemberBLL memberLogic = new MemberBLL();
        MovieBLL movieHandle = new MovieBLL();
        GenreBLL genreHandle = new GenreBLL();
        CommentBLL commentHandle = new CommentBLL();
        TicketBookingBLL tktBookingBLL = new TicketBookingBLL();
        ScheduleBLL scheduleLogic = new ScheduleBLL();

        public ActionResult Index(string search, string genre)
        {
            IEnumerable<Movie> movies;
            if (!string.IsNullOrEmpty(search))
            {
                movies = movieHandle.SearchMovieByTitle(search);
            }
            else if (!string.IsNullOrEmpty(genre))
            {
                movies = movieHandle.GetMovieByGenre(genre);
            }
            else
            {
                movies = movieHandle.GetAllMovies();
            }

            if (Request.IsAjaxRequest())
            {
                return PartialView("MovieSearch", movies);
            }
            return View(movies);
        }

        public ActionResult About()
        {
            return View();
        }

        public ActionResult Contact()
        {
            return View();
        }
    }
}
